#if !defined( TREE_MAKER_TREE_H)
#define TREE_MAKER_TREE_H

// standard headers
#include <string>
#include <iostream>
#include <cassert>

// component headers
#include <tree.h>
//8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888

//		bcpp_tree_maker

//________________________________________________________________________________________
//8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
struct bcpp_tree_maker
{
	bcpp_tree::t_tree& tree;
	bool root_node_added;
	bcpp_tree_maker(bcpp_tree::t_tree& t):tree(t), root_node_added(false){}
	void add_leaf(const std::string& name, unsigned i);
	void add_internal_node();
	void set_branch_len(float len);
	void reparent_to_grandparent();
	void finish();
	void add_sibling();
};
void bcpp_tree_maker::add_leaf(const std::string& name, unsigned i)
{
	tree.add_leaf(name, i);
}
void bcpp_tree_maker::add_internal_node()
{
	if (!root_node_added)
	{
		root_node_added = true;
		return;
	}

	assert (root_node_added);
	tree.add_internal_node();
}
void bcpp_tree_maker::set_branch_len(float len)
{
	assert (root_node_added);
	tree.set_branch_len(len);
}
void bcpp_tree_maker::reparent_to_grandparent()
{
	assert (root_node_added);
	tree.reparent_to_grandparent();
}
void bcpp_tree_maker::finish()
{
	tree.finish();
}
void bcpp_tree_maker::add_sibling()
{
	assert (root_node_added);
}

//8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888



#endif
